#include <bits/stdc++.h>

#define int long long

using namespace std;

void solve()
{
    int n;
    cin >> n;
    int len = 0;
    int t = n;
    while(t)
    {
        len ++;
        t = t / 10;
    }
    int p = 1;
    vector<int>v;
    for(int i = 1; i <= len; i ++)
    {
        p*=10;
		if(p + 1 > n){
			break;
		}
		if(n % (p + 1)==0){
			v.push_back(n / (p + 1));
		}
    }

    cout << v.size() << endl;
    if(v.size() == 0) return;
    sort(v.begin(),v.end());
    for(int i = 0; i < v.size(); i ++)
    {
        cout << v[i] << ' ';
    }
    cout << endl;
}
signed main()
{
    int t;
    cin >> t;
    while(t --)
    {
        solve();
    }
}